package xyz.iguilty.documents.doc.view;

import org.springframework.web.servlet.view.AbstractTemplateViewResolver;
import xyz.iguilty.documents.excel.view.ExcelTemplateView;
import xyz.iguilty.documents.starter.ExcelProperties;
import xyz.iguilty.documents.starter.WordProperties;


public class WordTemplateViewResolver extends AbstractTemplateViewResolver {

    public WordTemplateViewResolver() {
        this.setViewClass(requiredViewClass());
    }

    public WordTemplateViewResolver(String prefix, String suffix) {
        this();
        this.setPrefix(prefix);
        this.setSuffix(suffix);
    }

    public WordTemplateViewResolver(WordProperties wordProperties) {
        this();
        this.setPrefix(wordProperties.getPrefix());
        this.setSuffix(wordProperties.getSuffix()==null?".docx":wordProperties.getSuffix());
    }

    @Override
    protected Class<?> requiredViewClass() {
        return WordTemplateView.class;
    }

}
